home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / 16550.zip / NS16550A.H < prev    next >
Text File  |  1991-07-20  |  6KB  |  108 lines

  1. /*  "ns16550A.h"
  2.  
  3.     National Semiconductor Corporation
  4.     Microcomputer Systems Group
  5.  
  6.     Header file for the NS16550A UART in the IBM PC environment
  7.  
  8.     Written by : Louis Shay     1/11/89
  9. */
  10.  
  11. #define SERIAL_1  0x03f8
  12. #define SERIAL_2  0x02f8
  13. #define SERIAL_3  0x3220
  14. #define SERIAL_4  0x3228
  15. #define SERIAL_5  0x4220
  16. #define SERIAL_6  0x4228
  17. #define SERIAL_7  0x5220
  18. #define SERIAL_8  0x5228
  19.  
  20. /* UART register definitions using UART base address, int ubase */
  21.  
  22. #define RBR     (ubase+0)       /* Receive Buffer Register      (R  )(DLAB==0)*/
  23. #define THR    (ubase+0)    /* Transmitter Holding Register    (  W)(DLAB==0)*/
  24. #define IER    (ubase+1)    /* Interrupt Enable Register    (R/W)(DLAB==0)*/
  25. #define IIR    (ubase+2)    /* Interrupt Ident. Register    (R  ) */
  26. #define FCR     (ubase+2)       /* FIFO Control Register        (  W) */
  27. #define LCR     (ubase+3)       /* Line Control Register        (R/W) */
  28. #define MCR    (ubase+4)    /* MODEM Control Register    (R/W) */
  29. #define LSR    (ubase+5)    /* Line Status Register        (R  ) */
  30. #define MSR    (ubase+6)    /* MODEM Status Register    (R/W) */
  31. #define SCR    (ubase+7)    /* SCratch Register        (R/W) */
  32. #define DLL    (ubase+0)    /* Divisor Latch (LSB)        (R/W)(DLAB==1)*/
  33. #define DLM    (ubase+1)    /* Divisor Latch (MSB)        (R/W)(DLAB==1)*/
  34. #define AFR (ubase+2) /* Alternate Function Register(R/W) */
  35.  
  36. /* register read/write macros */
  37.  
  38. #define rdRBR()         ((int)inp(RBR))               /* read RBR */
  39. #define rdDLL()         ((int)inp(DLL))               /* read DLL */
  40. #define rdDLM()         ((int)inp(DLM))               /* read DLM */
  41. #define rdIER()         ((int)inp(IER))               /* read IER */
  42. #define rdIIR()         ((int)inp(IIR))               /* read IIR */
  43. #define rdLCR()         ((int)inp(LCR))               /* read LCR */
  44. #define rdMCR()         ((int)inp(MCR))               /* read MCR */
  45. #define rdLSR()         ((int)inp(LSR))               /* read LSR */
  46. #define rdMSR()         ((int)inp(MSR))               /* read MSR */
  47. #define rdSCR()         ((int)inp(SCR))               /* read SCR */
  48. #define rdAFR()         ((int)inp(AFR))               /* read AFR */
  49.  
  50. #define wrTHR(val)      (outp(THR, val))                /* write THR */
  51. #define wrDLL(val)      (outp(DLL, val))                /* write DLL */
  52. #define wrDLM(val)      (outp(DLM, val))                /* write DLM */
  53. #define wrIER(val)      (outp(IER, val))                /* write IER */
  54. #define wrFCR(val)      (outp(FCR, val))                /* write FCR */
  55. #define wrLCR(val)      (outp(LCR, val))                /* write LCR */
  56. #define wrMCR(val)      (outp(MCR, val))                /* write MCR */
  57. #define wrLSR(val)      (outp(LSR, val))                /* write LSR */
  58. #define wrMSR(val)      (outp(MSR, val))                /* write MSR */
  59. #define wrSCR(val)      (outp(SCR, val))                /* write SCR */
  60. #define wrAFR(val)      (outp(AFR, val))                /* write AFR */
  61.  
  62. #define RBR2     (ubase2+0)       /* Receive Buffer Register      (R  )(DLAB==0)*/
  63. #define THR2    (ubase2+0)    /* Transmitter Holding Register    (  W)(DLAB==0)*/
  64. #define IER2    (ubase2+1)    /* Interrupt Enable Register    (R/W)(DLAB==0)*/
  65. #define IIR2    (ubase2+2)    /* Interrupt Ident. Register    (R  ) */
  66. #define FCR2     (ubase2+2)       /* FIFO Control Register        (  W) */
  67. #define LCR2     (ubase2+3)       /* Line Control Register        (R/W) */
  68. #define MCR2    (ubase2+4)    /* MODEM Control Register    (R/W) */
  69. #define LSR2    (ubase2+5)    /* Line Status Register        (R  ) */
  70. #define MSR2    (ubase2+6)    /* MODEM Status Register    (R/W) */
  71. #define SCR2    (ubase2+7)    /* SCratch Register        (R/W) */
  72. #define DLL2    (ubase2+0)    /* Divisor Latch (LSB)        (R/W)(DLAB==1)*/
  73. #define DLM2    (ubase2+1)    /* Divisor Latch (MSB)        (R/W)(DLAB==1)*/
  74. #define AFR2 (ubase2+2) /* Alternate Function Register(R/W) */
  75.  
  76. /* register read/write macros */
  77.  
  78. #define rdRBR2()         ((int)inp(RBR2))               /* read RBR */
  79. #define rdDLL2()         ((int)inp(DLL2))               /* read DLL */
  80. #define rdDLM2()         ((int)inp(DLM2))               /* read DLM */
  81. #define rdIER2()         ((int)inp(IER2))               /* read IER */
  82. #define rdIIR2()         ((int)inp(IIR2))               /* read IIR */
  83. #define rdLCR2()         ((int)inp(LCR2))               /* read LCR */
  84. #define rdMCR2()         ((int)inp(MCR2))               /* read MCR */
  85. #define rdLSR2()         ((int)inp(LSR2))               /* read LSR */
  86. #define rdMSR2()         ((int)inp(MSR2))               /* read MSR */
  87. #define rdSCR2()         ((int)inp(SCR2))               /* read SCR */
  88. #define rdAFR2()         ((int)inp(AFR2))               /* read AFR */
  89.  
  90. #define wrTHR2(val)      (outp(THR2, val))              /* write THR */
  91. #define wrDLL2(val)      (outp(DLL2, val))              /* write DLL */
  92. #define wrDLM2(val)      (outp(DLM2, val))              /* write DLM */
  93. #define wrIER2(val)      (outp(IER2, val))              /* write IER */
  94. #define wrFCR2(val)      (outp(FCR2, val))              /* write FCR */
  95. #define wrLCR2(val)      (outp(LCR2, val))              /* write LCR */
  96. #define wrMCR2(val)      (outp(MCR2, val))              /* write MCR */
  97. #define wrLSR2(val)      (outp(LSR2, val))              /* write LSR */
  98. #define wrMSR2(val)      (outp(MSR2, val))              /* write MSR */
  99. #define wrSCR2(val)      (outp(SCR2, val))              /* write SCR */
  100. #define wrAFR2(val)      (outp(AFR2, val))              /* write AFR */
  101. /* end of ns16550A.h */
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.